function [ret] = myhist(data, wt, bins)
    dmax = max(data);
    dmin = min(data);
    %dd = (log(dmax - dmin)) / bins;
    dd = (dmax - dmin) / bins;
    if dd <= 0
        dd = (dmax) / bins;
    end
    if dd <= 0
        dd = 1e-13 / bins;
    end
    ret = zeros(bins, 2);
    for i = 1: bins
        %ret(i, 1) = exp(dd * i + log(dmin) - dd);
        ret(i, 1) = dd * i + dmin - dd;
    end
    for i = 1:size(data)
        index = ceil(data(i) / dd) + 1;%find(ret(:, 1) < data(i));
        if index > bins
            index = bins;
        end
        ret(index, 2) = ret(index, 2) + wt(i);
            %* multi;
    end
    if dd > 0
        ret(:, 2) = ret(:, 2) / (ret(2, 1) - ret(1, 1));
    end
    ret(:, 1) = ret(:, 1) / 1.6e-13;
end

        
    
